package com.quanyan.stadium.service.commonComponent.impl;

import com.quanyan.stadium.service.commonComponent.VersionControlService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by xiaoxiao on 17/3/1.
 */
@Service
public class VersionControlServiceImpl implements VersionControlService {

    @Value("#{'${android.client.ver}'.split(',')}")
    private List<String>  andClientVer;

    @Value("#{'${ios.client.ver}'.split(',')}")
    private List<String>  iosClientVer;



    //1:IOS 2: ANDROID 3 :WEIXIN 4 :H5 5:后台
    private final static int IOS_AND = 1;
    private final static int PLAT_AND = 2;


    @Override
    public boolean isNewestVer(int platFormType, String platVer) {
        if (platFormType == PLAT_AND) {
            if (andClientVer.contains(platVer))
                return false;
        }else if (platFormType == IOS_AND) {
            if (iosClientVer.contains(platVer))
                return false;
        }else {
            return true;
        }
        return true;
    }
}
